home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / AppleEvents / AEDescriptor.h < prev    next >
Text File  |  2000-06-23  |  2KB  |  65 lines

  1. // AEDescriptor.h
  2.  
  3. #ifndef AEDescriptor_h
  4. #define AEDescriptor_h
  5.  
  6. #ifndef AEType_h
  7. #include "AEType.h"
  8. #endif
  9. #ifndef MasterPointer_h
  10. #include "MasterPointer.h"
  11. #endif
  12.  
  13. class ConstAEListItem;
  14. class ConstAEMember;
  15. class ConstAEParameter;
  16. class ConstAEAttribute;
  17. class AEList;
  18. class AEStruct;
  19. class AEEvent;
  20.  
  21. class AEDescriptor: public AEDesc
  22.   {
  23.     private:
  24.         // not implemented:
  25.             void operator=( const AEDescriptor& );
  26.     
  27.     public:
  28.         AEDescriptor();
  29.         explicit AEDescriptor( const AEDescriptor& );
  30.         AEDescriptor( ConstData data, AEType type );
  31.         AEDescriptor( const AEDescriptor&, AEType type );
  32.         
  33.         explicit AEDescriptor( const ConstAEListItem&,    AEType type = AEType::Any() );    // In ConstAEListItem.cp
  34.         explicit AEDescriptor( const ConstAEMember&,        AEType type = AEType::Any() );    // In ConstAEMember.cp
  35.         explicit AEDescriptor( const ConstAEParameter&,    AEType type = AEType::Any() );    // In ConstAEParameter.cp
  36.         explicit AEDescriptor( const ConstAEAttribute&,    AEType type = AEType::Any() );    // In ConstAEAttribute.cp
  37.         
  38.         ~AEDescriptor();
  39.  
  40.         AEList& AsList()                                                     { return *reinterpret_cast<AEList*>(this); }
  41.         const AEList& AsList() const                                     { return *reinterpret_cast<const AEList*>(this); }
  42.  
  43.         AEStruct& AsRecord()                                             { return *reinterpret_cast<AEStruct*>(this); }
  44.         const AEStruct& AsRecord() const                             { return *reinterpret_cast<const AEStruct*>(this); }
  45.  
  46.         AEEvent& AsEvent()                                                 { return *reinterpret_cast<AEEvent*>(this); }
  47.         const AEEvent& AsEvent() const                                 { return *reinterpret_cast<const AEEvent*>(this); }
  48.  
  49.         bool IsNull() const                { return dataHandle == 0; }
  50.         bool Allocated() const            { return dataHandle != 0; }
  51.         void Dispose();
  52.         
  53.         void Swap( AEDescriptor& );
  54.         
  55.         AEType Type() const
  56.             { Assert( Allocated() ); return AEType( descriptorType ); }
  57.         
  58.         const MasterPointer& Value() const
  59.             { Assert( Allocated() ); return MasterPointer::At( dataHandle ); }
  60.         
  61.         void Get( AEType, Data ) const;
  62.   };
  63.  
  64. #endif
  65.